<?php /* Create Accountancy Controller */
	require_once('modules/accountancy/actions/create/scripts/validate-accountancy.php');
	if (isset($_POST['form-action'])) {
		$validacion = validarRegistro();
		if (!empty($validacion)) { //fallo validacion
			$validacion = 'ERROR: '.implode(',', $validacion);
			$titulo = $accountancy->getTitulo();
			$descripcion = $accountancy->getDescripcion();
			$fecha_vencimiento = $accountancy->getFechaVencimiento();
			$fecha_pagado = $accountancy->getFechaPagado();
			$monto = $accountancy->getMonto();
			$estado = $accountancy->getEstado();
			$nota = $accountancy->getNota();
			$alumno = $accountancy->getFkDestino();
			$arr_students = $accountancy->getStudents();
			require_once('modules/accountancy/actions/create/view/create-accountancy.php');
		} else { //si valido correcto
			$accountancy->create();
			//$student->sendEmail();
			require_once('modules/accountancy/actions/list/index.php');
		}
	} else {
		$arr_students = $accountancy->getStudents();
		$alumno = 0;
		$estado = 1;
		$titulo = '';
		$descripcion = '';
		$monto = '0.00';
		$fecha_vencimiento = date('d/m/y',(time()+(4*7*24*60*60)));
		$fecha_pagado = '';
		$nota = '';
		require_once('modules/accountancy/actions/create/view/create-accountancy.php');
	}
?>